package com.zj.common.exception;

import com.zj.common.ResultEnum;
import lombok.Getter;

/**
 * @author zhangbo
 * @program: PDF-helper
 * @ClassName CommonException
 * @description: $
 * @date 2023-05-22 21:40:03
 */
@Getter
public class CommonException extends RuntimeException {

    /**
     * 自定义状态码
     */
    private Integer code;

    /**
     * 自定义描述信息
     */
    private String msg;


    /**
     * 枚举异常
     *
     * @param resultEnum 枚举
     */
    public CommonException(ResultEnum resultEnum) {
        super(resultEnum.getMsg());
        this.code = resultEnum.getCode();
    }


    /**
     * 自定义描述信息
     *
     * @param msg 描述信息
     */
    public CommonException(String msg) {
        super(msg);
        this.msg = msg;
        this.code = ResultEnum.ERROR.getCode();
    }

    /**
     * 自定义状态和描述信息
     *
     * @param code 状态码
     * @param msg  描述信息
     */
    public CommonException(Integer code, String msg) {

    }
}
